<template>
    <fieldset>
        <legend>列表页</legend>
        <ul>
            <li v-for="item in products" :key="item._id">
                <b @click="tick(item)">{{ item.productName }}</b>
            </li>
        </ul>
    </fieldset>
</template>
<script>
import axios from "axios"
export default {
    data(){
        return {
            products:[]
        }
    },
    mounted(){
        axios.get('http://chst.vip:1234/api/getmoneyctrl')
        .then(res=>{
            console.log(res)
            this.products = res.data.result
        })
    },
    methods:{
        tick(item){
            this.$router.push({path:"/detail",query:{name:item.productId}})
        }
    }
}
</script>
<style>
b{
    cursor: pointer;
}
</style>